package com.itheima.thread3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo01 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //创建Callable实现类对象

        MyCallable mycall = new MyCallable();
        //创建 FutrueTask对象 使用Callable的实现类对象
        FutureTask<String> task = new FutureTask<>(mycall);
        //创建Thread 对象 使用FutrueTask对象
        Thread thread = new Thread(task);
        //调用start方法
        thread.start();


        for (int i = 0; i < 100; i++) {

            System.out.println("main方法的"+i);
        }
        String s = task.get();
        System.out.println(s);

    }

}
